package com.chilly.other.pattern.strategy2;

/**
 * 工厂模式+策略模式
 * https://blog.csdn.net/zzwithk/article/details/112361826
 * Created by Chilly Cui on 2021/1/12.
 */
public class MainTest {
    public static void main(String[] args) {
        Factory factory = new StrategyFactory();
        // 当strategyName的值不同时，会获取到不同的策略实例。当我们要新增一个策略时，只需实现Strategy接口
        String strategyName = "strategyA";
        Strategy strategy = factory.createStrategy(strategyName);
        strategy.doOperation();
    }
}
